﻿using Framework.Domain.Interface.DomainObject.Bo;
using System;

namespace Framework.Domain.DomainObject.Bo
{
    public class BaseBo : BaseObject, IBaseBo
    {
        /// 获取数据的创建时间
        /// </summary>
        protected DateTime CreateTime
        {
            get
            {
                return (this.Entity as BaseBoEntity).CreateTime;
            }
        }

        /// <summary>
        /// 获取数据的创建人KeyId
        /// </summary>
        protected Guid CreateUserKeyId
        {
            get
            {
                return (this.Entity as BaseBoEntity).CreateUserKeyId;
            }
        }

        /// <summary>
        /// 获取数据的修改时间
        /// </summary>
        protected DateTime UpdateTime
        {
            get
            {
                return (this.Entity as BaseBoEntity).UpdateTime;
            }
        }

        /// <summary>
        /// 获取数据的修改人KeyId
        /// </summary>
        protected Guid UpdateUserKeyId
        {
            get
            {
                return (this.Entity as BaseBoEntity).UpdateUserKeyId;
            }
        }

        /// <summary>
        /// 返回数据是否已经逻辑删除
        /// </summary>
        protected bool IsDelete
        {
            get
            {
                return (this.Entity as BaseBoEntity).IsDelete;
            }
            set
            {
                (this.Entity as BaseBoEntity).IsDelete = value;
            }
        }


        /// <summary>
        /// 获取版本
        /// </summary>
        protected int Version
        {
            get
            {
                return (this.Entity as BaseBoEntity).Version;
            }
            set
            {
                (this.Entity as BaseBoEntity).Version = value;
            }
        }

        /// <summary>
        /// 获取数据的创建时间
        /// </summary>
        /// <returns>创建时间</returns>
        public DateTime GetCreateTime()
        {
            return this.CreateTime;
        }

        /// <summary>
        /// 获取数据的创建人KeyId
        /// </summary>
        /// <returns>创建人KeyId</returns>
        public Guid GetCreateUserKeyId()
        {
            return this.CreateUserKeyId;
        }

        /// <summary>
        /// 获取数据的修改时间
        /// </summary>
        /// <returns>修改时间</returns>
        public DateTime GetUpdateTime()
        {
            return this.UpdateTime;
        }

        /// <summary>
        /// 获取数据的修改人KeyId
        /// </summary>
        /// <returns>修改人KeyId</returns>
        public Guid GetUpdateUserKeyId()
        {
            return this.UpdateUserKeyId;
        }

        /// <summary>
        /// 获取数据是否已经逻辑删除
        /// </summary>
        /// <returns>是否已经逻辑删除</returns>
        public bool GetIsDelete()
        {
            return this.IsDelete;
        }

        /// <summary>
        /// 设置数据是否已经逻辑删除 ysw_add
        /// </summary>
        /// <returns>是否已经逻辑删除</returns>
        public bool SetIsDelete(bool isDelete = false)
        {
            return this.IsDelete = isDelete;
        }

        /// <summary>
        /// 获取版本信息
        /// </summary>
        /// <returns>版本信息</returns>
        public int GetVersion()
        {
            return this.Version;
        }

        /// <summary>
        /// 设置版本信息
        /// </summary>
        /// <param name="version">版本信息</param>
        public void SetVersion(int version)
        {
            this.Version = version;
        }

    }
}
